#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define LL long long
#define fi first
#define se second
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define ll long long
#define ff first
#define ss second 
const ldb LDINF = 9128739847123.00;
const ldb eps = 1e-9;
const int inf = 1 << 28;
const ldb pi = fabsl(atan2l(0.0, -1.0));
using namespace std;
#define y1 y6
int x1, y1, x2, y2;
int d;

void load()
{
	cin >> x1 >> y1 >> x2 >> y2;
}

int dx[200002];
int sz;
int x[200002];
int y[200002];
int dp[1001][1001];
int was[300000];
int usd;


int f(int i, int j)
{
	if (dp[i][j] != -1) return dp[i][j];
	for (int k = 1; k * d < i || k * d < j; k++)
	{
		if (i - k * d > 0 && j - k * d > 0)
			f(i - k * d, j - k * d);
		if (i - k * d > 0)
			f(i - k * d, j);
		if (j - k * d > 0)
			f(i, j - k * d);
	}
	usd++;
	for (int k = 1; k * d < i || k * d < j; k++)
	{
		if (i - k * d > 0 && j - k * d > 0)
			was[f(i - k * d, j - k * d)] = usd;
		if (i - k * d > 0)
			was[f(i - k * d, j)] = usd;
		if (j - k * d > 0)
			was[f(i, j - k * d)] = usd;
	}
	for (dp[i][j] = 0; was[dp[i][j]] == usd; dp[i][j]++);
	return dp[i][j];
}

ll count(int i, int *x, int *y)
{
	int a = max(x[i], x1);
	int b = min(x[i] + d - 1, x2);
	int c = max(y[i], y1);
	int e = min(y[i] + d - 1, y2);
	if (b >= a && e >= c)
		return (ll)((ll)b - a + 1) * ((ll)e - c + 1);
	return 0;	
}


ll solve(int *x, int *y)
{
	int l = 0;
	int r = sz;
	int mid;
	int lft = -1;
	int rgt = -1;
	while (l <= r)
	{
		mid = (l + r) / 2;
		if (x[mid] + d - 1 >= x1 && y[mid] + d - 1 >= y1)
		{
			lft = mid;
			r = mid - 1;
		}
		else l = mid + 1;
	}
	l = 0;
	r = sz;
	while (l <= r)
	{
		mid = (l + r) / 2;
		if (x[mid] - d + 1 <= x2 && y[mid] - d + 1 <= y2)
		{
			rgt = mid;
			l = mid + 1;
		}
		else r = mid - 1;
	}
	ll res = 0;
	for (int q = 0; q < 3 && lft <= rgt; lft++, q++)
		res += count(lft, x, y);
	for (int q = 0; q < 3 && lft <= rgt; rgt--, q++)
		res += count(rgt, x, y);
	if (lft <= rgt)
		res += ((ll)rgt - lft + 1) * (ll)d * (ll)d;
	return res;
}



void solve()
{
	ll cnt = 0;
	
	int li = 0, lj = 0;
	for (int i = 0; i < x2 - x1 + 1; i++)
	{
	//	printf("%3d: ", x1 + i);
		for (int j = 0; j < y2 - y1 + 1; j++)
		{
			if (f(x1 + i, y1 + j))
			{
			//	printf("1");
			}
			else
			{
			//	printf("0");
				cnt++;
				if (i <= j && i >= li + d && j >= lj + d)
				{
					//cerr << (i - li) / d << " "; //<< j - lj << "\n";
					li = i;
					lj = j;
				}
			}
		}
	//	printf("\n");
	}
	/*
	x1--;
	y1--;
	x2--;
	y2--;
	cnt += solve(x, y);
	cnt += solve(y, x);
	cnt -= count(0, x, y);

	
/*	int x = 0, y = 0;
	int a, b, c, e;
	cerr << d << "\n";
	for (int j = 0; j < 200000 && x <= x2 && y <= y2; j++)
	{
		a = max(x, x1);
		b = min(x + d - 1, x2);
		c = max(y, y1);
		e = min(y + d - 1, y2);
		if (b - a + 1 > 0 && e - c + 1 > 0)
		{
			cnt += (ll)(b - a + 1) * (ll)(e - c + 1);
		}
		if (x != 0 || y != 0)
		{
			swap(x, y);
			a = max(x, x1);
			b = min(x + d - 1, x2);
			c = max(y, y1);
			e = min(y + d - 1, y2);
			if (b - a + 1 > 0 && e - c + 1 > 0)
				cnt += (ll)(b - a + 1) * (ll)(e - c + 1);
			swap(x, y);			
		}
		x += ::x[j] * d;
		y += (::x[j] + 1) * d;
	}
	*/
	ll d = ((ll)x2 - x1 + 1) * ((ll) y2 - y1 + 1);
	ll g = __gcd(d, cnt);
	d /= g;
	cnt /= g;
	cout << cnt << "/" << d << "\n";
}

/*
0: 1 2 1 2 2 
5: 1 2 1 2 2 1 2 2 
13: 1 2 1 2 2 
18: 1 2 1 2 2 1 2 2 
26: 1 2 1 2 2 1 2 2 
34: 1 2 1 2 2 
39: 1 2 1 2 2 1 2 2 
47: 1 2 1 2 2 
52: 1 2 1 2 2 1 2 2 
60: 1 2 1 2 2 1 2 2 
68: 1 2 1 2 2 
73: 1 2 1 2 2 1 2 2 
81: 1 2 1 2 2 1 2 2 

89: 1 2 1 2 2 
94: 1 2 1 2 2 1 2 2 
102:1 2 1 2 2 
    1 2 1 2 2 1 2 2 
    1 2 1 2 2 1 2 2 
    1 2 1 2 2 
    1 2 1 2 2 1 2 2  
    1 2 1 2 2 
*/

#define file "b"
int main()
{
	#ifndef ONLINE_JUDGE
		freopen(file".in", "rt", stdin);
		freopen(file"2.out", "wt", stdout);
	#endif
	dx[0] = 1;
	dx[1] = 2;
	dx[2] = 1;
	dx[3] = 2;
	dx[4] = 2;
	for (int i = 5; i < 10; i++)
		dx[i] = dx[i - 5];
	dx[10] = 1;
	dx[11] = 2;
	dx[12] = 2;
	for (int i = 13; i < 13 + 5; i++)
		dx[i] = dx[i - 13];
	for (int i = 18; i < 18 + 8; i++)
		dx[i] = dx[i - 18 + 5];
	for (int i = 26; i < 26 + 8; i++)
		dx[i] = dx[i - 26 + 5];
	for (int i = 34; i < 34 + 5; i++)
		dx[i] = dx[i - 34];
	for (int i = 39; i < 39 + 8; i++)
		dx[i] = dx[i - 39 + 5];
	for (int i = 47; i < 47 + 5; i++)
		dx[i] = dx[i - 47];
	for (int i = 52; i < 52 + 8; i++)
		dx[i] = dx[i - 52 + 5];
	for (int i = 60; i < 60 + 8; i++)
		dx[i] = dx[i - 60 + 5];
	for (int i = 68; i < 68 + 5; i++)
		dx[i] = dx[i - 68];
	for (int i = 73; i < 73 + 8; i++)
		dx[i] = dx[i - 73 + 5];
	for (int i = 81; i < 81 + 8; i++)
		dx[i] = dx[i - 81 + 5];
	for (int i = 89; i < 200000; i++)
		dx[i] = dx[i - 89];
	int T;
	cin >> d >> T;
	x[0] = 0;
	y[0] = 0;
	for (int i = 0; x[i] <= 200000 && y[i] <= 200000; i++)
	{
		sz = i;
		x[i + 1] = x[i] + dx[i] * d;
		y[i + 1] = y[i] + (dx[i] + 1) * d;
	}	
	
	memset(dp, -1, sizeof dp);
	for (int i = 0; i < T; i++)
	{
		load();
		solve();
	}
	return 0;
}
